//导入的request实际上就是在request.js文件中定义的service对象。
import request from '@/utils/request'

export function getList(sceneId) {
  return request({
    url: '/ssl/list/'+sceneId,
    method: 'get',
  })
}
export function getLine(id) {
  return request({
    url: '/scene/getLineBySceneID/'+id,
    method: 'get',
  })
}
export function getActivity(id){
  return request({
    url: '/scene/getActivityBySceneID/'+id,
    method: 'get',
  })
}
export function getChainInfo(idList) {
  return request({
    url: '/ssl/chainInfo',
    method: 'post',
    data:idList
  })
}

// 上传抽象装备类
// @param categoryname String 新装备名字
// @param categorydomains List 格式为中文逗号分隔的“属性，单位”的属性列表
export function uploadCategoryInfo(categorydomains){
  return request({
    url:'/equipment/uploadCategoryInfo',
    method:'post',
    data:categorydomains
  })
}

//上传更新装备信息
export function upEquipmentInfo(equipmentId,data){
  
  const requestData = {
    equipmentId,
    data
  };
  return request({
    url:'/equipment/upEquipmentInfo',
    method:'post',
    data:requestData
  })
}



//根据抽象类名字来查询各个属性来绘制添加元素列表
// @param categoryname String 被点击装备的名字
export function downloadCatgoryInfo(categoryname){
  return request({
    url:'/equipment/downloadCatgoryInfo',
    method:'get',
    data:categoryname
  })
}

//根据输入的装备实例来上传装备数据
// @param equipmentmap String 被点击装备的名字
export function uploadEquipmentInfo(equipmentmap,categoryname){
  return request({
    url:'/equipment/uploadEquipmentInfo/'+categoryname,
    method:'post',
    data:equipmentmap
  })
}

//根据抽象类名字来查询具体实例列表
// @param categoryname String 被点击装备的名字
export function downloadEquipmentList(categoryname){
  return request({
    url:'/equipment/downloadEquipmentList/'+categoryname,
    method:'get'
  })
}

//根据具体实例名字来查询具体实例信息
// @param categoryname String 被点击装备的名字
export function downloadEquipmentInfo(equipmentname){
  return request({
    url:'/equipment/downloadEquipmentInfo/'+equipmentname,
    method:'get'
  })
}

//获取整个子树结构
// @param name String 就是装备要素
export function downloadCatgoryList(name){
  return request({
    url:'/equipment/downloadCatgoryList',
    method:'get',
    data:name
  })
}

//查询所有的装备名称
//@param
export function downloadEquipmentname(){
  return request({
    url:'/equipment/downloadEquipmentname',
    method:'get'
  })
}
//杀伤链场景数据
//@param data 杀伤链场景创建的相关数据
export function creatSslscene(data) {
  console.log(data)
  return request({
    url: '/scene/creatSslscene',
    method: 'post',
    data: data
  })
}
//获取数据库所有杀伤链场景
//@param
export function getSceneList(){
  return request({
    url:'/scene/getSceneList',
    method:'get',
  })
}

//根据给定的场景ID来获取杀伤链列表
//@param sceneID 场景ID
export function getSslListBySceneID(sceneID){
  return request({
    url:'/scene/getSslListBySceneID/'+sceneID,
    method:'get',
  })
}

//根据给定的杀伤链ID来获取时间链
//@param SSLID 杀伤链ID
//需要一个map，[key:"事件",value:每个t]
export function getTimeChainBySSLID(SSLID){
  return request({
    url:'/scene/getTimeChainBySSLID/'+SSLID,
    method:'get',
  })
}

//根据给定的杀伤链ID来获取精度链
//@param SSLID 杀伤链ID
//把三个坐标封装传回
export function getPrecisionChainBySSLID(SSLID){
  return request({
    url:'/scene/getPrecisionChainBySSLID/'+SSLID,
    method:'get',
  })
}

//获取选定场景的详细信息
//@param SceneID 场景ID
export function getSceneInfoBySceneID(SceneID){
  return request({
    url:'/scene/getSceneInfoBySceneID/'+SceneID,
    method:'get',
  })
}
//获取选定场景的详细信息
//@param SceneID 场景ID
export function openProtege(){
  return request({
    url:'/protege/open',
    method:'get',
  })
}

//获取选定场景的详细信息
//@param SceneID 场景ID
export function downloadImage(sceneName){

  return request({
    url:'/api/downloadImage',
    method:'post',
    data:[sceneName]
  })
}

/**
 * 导出系统信息
 * @returns 
 */
export function exportSys(){
  return request({
    url:'/file/export',
    method:'get',
  })
}

